﻿<%@ WebHandler Language="C#" Class="loginAjax"%>

using System;
using System.Web;
using System.Web.SessionState;

public class loginAjax : IHttpHandler, IRequiresSessionState
{
    
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        string userName=context.Request.QueryString["user"];
        string pwd = context.Request.QueryString["pwd"];
        NVR.BLL.UserInfo user = new NVR.BLL.UserInfo();
        int loginFlag = user.IsExist(userName, pwd);
        if(loginFlag==1)
        {
            HttpContext.Current.Session.Add("username",userName);
            HttpContext.Current.Session.Add("pwd",pwd);
        }
        context.Response.Write(loginFlag);
    }
    public bool IsReusable {
        get {
            return false;
        }
    }
}